﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

namespace Tetris
{
    class SystemTime
    {
        /// <summary>
        /// Structure used to store the system time and to display it
        /// </summary>
        struct SYSTEMTIME
        {
            public ushort wYear;
            public ushort wMonth;
            public ushort wDayOfWeek;
            public ushort wDay;
            public ushort wHour;
            public ushort wMinute;
            public ushort wSecond;
            public ushort wMilliseconds;
        };

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern bool GetSystemTime(ref SYSTEMTIME lpSystemTime);
        /// <summary>
        /// get the now system time
        /// </summary>
        /// <returns>a formated string of the time</returns>
        public static string getSystemTime()
        {
            SYSTEMTIME Timenow = new SYSTEMTIME();
            bool returnCode = GetSystemTime(ref Timenow);

            return (Timenow.wHour + 1).ToString() + ":" + Timenow.wMinute.ToString() + ":" + Timenow.wSecond.ToString();
        }
    }
}
